<template>
	<view class="Jy_index_page">
		<view class="start_up_image_box">
			<image :src="imageUrl" mode="aspectFill"></image>
		</view>
		<view class="more_tg_group">
			<view class="timer_group">
				<view class="timer_box">
					<text>{{count}}</text>
					<text>s</text>
				</view>
				<view class="tg_button_box" @click="getSwitchHome()">
					<text>跳过</text>
				</view> 
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// 启动图
				imageUrl: this.$mAssetsPath.indexStartupDiagramUrl,
				count: 10,
				timer: null,
			}
		},
		onLoad() {
			this.getTimer()
		},
		onUnload() {
			if (this.timer) {
				clearInterval(this.timer)
			}
		},
		methods: {
			// 开始倒计时
			getTimer() {
				this.timer = setInterval(() => {
					this.count --;
					if (this.count == 0) {
						clearInterval(this.timer);
						uni.switchTab({
							url: '/pages/main/customerHome/customerHome'
						})
					}
				}, 1000)
			},
			// 点击跳过
			getSwitchHome() {
				uni.switchTab({
					url: '/pages/main/customerHome/customerHome'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
@import 'index.scss';
</style>
